public class PreorderTree extends SortedTree {
	
	public PreorderTree(String node) {
		super(node);
	}
	
	public PreorderTree() {
		super();
	}
	
	@Override
	public String traverse() {
		return recTraverse(rootNode);
	}
	
	private String recTraverse(StringNode node) {
		String temp = node.getLabel();

		if (node.getLeftChild() != null) {
			temp = temp + " " + recTraverse(node.getLeftChild());
		}
		
		if (node.getRightChild() != null) {
			temp = temp + " " + recTraverse(node.getRightChild());
		}
		return temp;
	}
	
}
